package com.project.service.ipml;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ProjectBean;
import com.project.mapper.IProjectMapper;
import com.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ProjectServiceImpl implements IProjectService {
    @Autowired
    private IProjectMapper mapper;

    @Override
    public PageInfo<ProjectBean> cutPageFindByItem(int pageNo, String name, String status, String order) {
        PageHelper.startPage(pageNo, 3);
        PageInfo<ProjectBean> pageInfo = PageInfo.of(mapper.cutPageFindByItem(name, status, order));
        return pageInfo;
    }

    @Override
    public void add(ProjectBean projectBean) {
        mapper.add(projectBean);
    }

    @Override
    public ProjectBean findById(Integer id) {
        return mapper.getById(id);
    }
}
